
#ifndef _APDU_LIB_UDISK_H_
#define _APDU_LIB_UDISK_H_

#include "../apdu.def/apdu_datatypes.h"
#include "../apdu.def/apdu_defs.h"

#define DISK_TYPE_CD	0
#define DISK_TYPE_SD	1
#define DISK_TYPE_ND	2
#define DISK_TYPE_HD	3


#pragma pack(1)

typedef struct
{
	unsigned int	DiskCapa;
	unsigned int	LBA;
	unsigned char	lun;
	unsigned char	type;

}DiskItem_t;

#pragma pack()

#ifdef __cplusplus
extern "C" {
#endif
	long libukey_format(HANDLE devHandle, char * adminPin, char * userPin, 
		unsigned long CDSize, unsigned long NDSize,
		unsigned long SDSize, unsigned long HDSize);

	long libukey_set_disk_sizes(HANDLE devHandle, unsigned long CDSize, unsigned long NDSize,
		unsigned long SDSize, unsigned long HDSize);

	long libukey_get_disk_sizes(HANDLE devHandle,  unsigned long * CDSize, unsigned long * NDSize,
		unsigned long * SDSize, unsigned long * HDSize);

	long libukey_get_total_size(HANDLE devHandle, unsigned long * total, unsigned long * sector_size, unsigned long * sizeUnit);

	long libukey_write_disk(HANDLE devHandle, long diskType, 
		unsigned long startSector, long sectorNumber, unsigned char * pBuffer );

	long libukey_read_disk(HANDLE devHandle, long diskType, 
		unsigned long startSector, long sectorNumber, unsigned char * pBuffer );


	long libukey_login_sd(HANDLE devHandle, unsigned char * sec_pwd, long pwd_len);

	long libukey_logout_sd(HANDLE devHandle);

	long libukey_set_sd_pin(HANDLE devHandle, unsigned char * sec_pwd, long pwd_len);

	long libukey_get_sd_state(HANDLE devHandle, long * state);

	float libukey_get_sector_ratio( HANDLE devHandle );

#ifdef __cplusplus
}
#endif

#endif
